        
    let user = document.querySelector('input[type=text]')
    let pass = document.querySelector('input[type=password]')
    let btn = document.querySelector('input[type=button]')
    btn.onclick =function(){
        let user1= user.value
        let pass1 = pass.value
        let obj = {}
        obj.name = user1
        obj.password = pass1
        console.log(obj)
        let userInfo = JSON.parse(localStorage.getItem('userInfo')) || []
        console.log(userInfo);
        if(user1 == '' || pass1 == ''){
                alert('请输入账号或密码')
                return
        }else{
        if(userInfo.some((item)=>item.name==obj.name && item.password == obj.password )){
            alert('去购物吧 ！')
            location.href = '../index.html'
        }else{
            alert('账号或密码错误')
        }
    }

    }
    
    
    
